package com.wnnight.wys.serviceImpl.car;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wnnight.wys.entity.car.Park;
import com.wnnight.wys.mapper.car.ParkMapper;
import com.wnnight.wys.service.car.ParkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName: PackServiceImpl
 * @Description: 车位实现
 * @author: CHX42
 * @date: 2022/8/28-13:38
 * @version: v1.0
 */
@Service
@Transactional
public class ParkServiceImpl extends ServiceImpl<ParkMapper, Park> implements ParkService {
    @Autowired
    private ParkMapper parkMapper;
    @Override
    public List<Park> getAll(Park park) {
        return parkMapper.getAll(park);
    }

    @Override
    public Page<Park> getpage(IPage<Park> page, Wrapper wrapper) {
        return parkMapper.getPage(page,wrapper);
    }

    @Override
    public List<Park> getByLandlordId(Integer landlordId) {
        QueryWrapper<Park> carWrapper = new QueryWrapper<>();
        carWrapper.eq("wys_park.landlord_id",landlordId);
        return parkMapper.getPage(new Page<>(1,100),carWrapper).getRecords();
    }

}
